package com.stormrage.edu.serv.shiro.impl;

import java.util.Set;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.stormrage.edu.serv.acct.EntAcctServ;
import com.stormrage.edu.serv.acct.EntResServ;
import com.stormrage.edu.serv.shiro.ShiroServ;
import com.stormrage.entity.ent.EntAcct;
import com.stormrage.entity.ent.EntRes;
import com.stormrage.entity.shiro.ShiroAcct;
import com.stormrage.entity.shiro.ShiroRes;
import com.stormragetech.core.exception.StormrageTechException;

/**
 * @author www.stormragetech.com
 * @date 2016年3月30日
 * @version 1.0.0
 */
@Service
public class ShiroServImpl implements ShiroServ {

	private static final Logger logger = LoggerFactory.getLogger(ShiroServImpl.class);

	@Autowired
	private EntAcctServ acctServ;

	@Autowired
	private EntResServ resServ;

	@Override
	public ShiroAcct queryAcctById(String arg0) throws StormrageTechException {

		logger.debug(" 【 Dao 】- 【 ShiroServ 】- 【 QueryAcctById 】- 开始 ");

		EntAcct acct = acctServ.queryById(Integer.valueOf(arg0));

		logger.debug(" 【 Dao 】- 【 ShiroServ 】- 【 QueryAcctById 】- 完成 ");
		return ShiroAcct.instance(acct);
	}

	@Override
	public ShiroAcct queryAcctByAcct(String arg0) throws StormrageTechException {

		logger.debug(" 【 Dao 】- 【 ShiroServ 】- 【 QueryAcctByAcct 】- 开始 ");

		EntAcct acct = acctServ.queryByAcct(arg0);

		logger.debug(" 【 Dao 】- 【 ShiroServ 】- 【 QueryAcctByAcct 】- 完成 ");
		return ShiroAcct.instance(acct);
	}

	@Override
	public ShiroRes queryResById(String arg0) throws StormrageTechException {

		logger.debug(" 【 Dao 】- 【 ShiroServ 】- 【 QueryAcctByAcct 】- 开始 ");

		EntRes res = resServ.queryById(Integer.valueOf(arg0));

		logger.debug(" 【 Dao 】- 【 ShiroServ 】- 【 QueryAcctByAcct 】- 完成 ");
		return ShiroRes.instance(res);
	}

	@Override
	public Set<String> queryPermSet() throws StormrageTechException {

		logger.debug(" 【 Dao 】- 【 ShiroServ 】- 【 QueryAcctByAcct 】- 开始 ");

		Set<String> rs = acctServ.queryPermSet();

		logger.debug(" 【 Dao 】- 【 ShiroServ 】- 【 QueryAcctByAcct 】- 完成 ");
		return rs;
	}

	@Override
	public Set<String> queryPermSetById(String arg0) throws StormrageTechException {

		logger.debug(" 【 Dao 】- 【 ShiroServ 】- 【 QueryAcctByAcct 】- 开始 ");

		Set<String> rs = acctServ.queryPermSetById(Integer.valueOf(arg0));

		logger.debug(" 【 Dao 】- 【 ShiroServ 】- 【 QueryAcctByAcct 】- 完成 ");
		return rs;
	}

}
